package com.lx.dao.impl;

import com.lx.dao.AdminDao;
import com.lx.uitl.ConnUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @title: AdminDaoImpl
 * @projectName bankManage
 * @description: TODO
 * @author: yuanChu
 * @date: 2022/5/6  8:36
 */
public class AdminDaoImpl implements AdminDao {
    @Override
    public String loginAdmin(String name) throws SQLException {
        Connection conn = ConnUtil.getConnection();
        String sql = "select * from admin where admin_name = ?";
        PreparedStatement ps = conn.prepareStatement(sql);
        ps.setString(1,name);
        ResultSet rs = ps.executeQuery();
        rs.next();
        String password = rs.getString("admin_pwd");
        ps.close();
        return password;
    }
}
